#include<iostream>
#include<iomanip>
using namespace std;
class Date {
	int year, month, day;
public:
	Date();
	Date(int y, int m, int d);
	int getYear();
	int getMonth();
	int getDay();
	void setDate(int y, int m, int d);
	void print();
	void addOneDay();
};
Date::Date() {

}
Date::Date(int y, int m, int d) {
	year = y;
	month = m;
	day = d;
}
int Date::getYear() {
	return year;
}
int Date::getMonth() {
	return month;
}
int Date::getDay() {
	return day;
}
void Date::setDate(int y, int m, int d) {
	year = y;
	month = m;
	day = d;
}
void Date::print() {
	cout << year << '/';
	cout << setfill('0') << setw(2) << month << '/';
	cout << setfill('0') << setw(2) << day << endl;
}
void Date::addOneDay() {
	int arr[12] = { 31,28,31,30,31,30,31,31,30,31,30,31 };
	if (year % 400 == 0 || year % 4 == 0 && year % 100 != 0) {
		arr[1]++;
	}
	day++;
	if (day > arr[month - 1]) {
		day -= arr[month - 1];
		month++;
		if (month > 12) {
			month -= 12;
			year++;
		}
	}

}
int main()
{
	int t;
	cin >> t;
	for (int i = 0; i < t; i++) {
		int year, month, day;
		cin >> year >> month >> day;
		Date d1(year, month, day);
		cout << "Today is ";
		d1.print();
		d1.addOneDay();
		cout << "Tomorrow is ";
		Date d2;
		d2.setDate(d1.getYear(), d1.getMonth(), d1.getDay());
		d2.print();
	}
}